#!/bin/bash

mkdir -p output

dic=data/palavras.txt
times=3

function calc
{
    echo 
    echo "-------------------"
    echo "WD_SIZE =" $1
    echo "-------------------"


#    echo 
#    echo "** Sequencial "

#    for size in $1
#    do
#            for (( j=1; j<=times; j++ ))
#            do
#                echo "./bin/random_${size} $dic >> output/random_wdsize_${size}.txt"
#                ./bin/random_${size} $dic >> output/random_wdsize_${size}.txt
#            done
#    done


    echo     
    echo "** Paralelo"
    
    for size in $1
    do
            for (( k=32; k>=8; k=k/2 ))
            do
                for (( j=1; j<=times; j++ ))
                do
                    echo "optirun ./bin/gpu_random_${size} $dic $k $k >> output/random_wdsize${size}_block_${k}_thread_${k}.txt"
                    optirun ./bin/gpu_random_${size} $dic $k $k >> output/random_wdsize${size}_block_${k}_thread_${k}.txt
                    sleep 600
                done
            done
    done
}

#calc 5
calc 6
